/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

#include "tim.h"
#include "i2c.h"
#include "usart.h"
#include "adc.h"
#include "spi.h"

#include "delay.h"
#include "board.h"
#include "moto.h"
#include "servo.h"
#include "gyro.h"
#include "eeprom.h"
#include "robo.h"
#include "OLED.h"
#include "jy60.h"

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define LED_TIM_PSC (75-1)
#define LED_TIM_ARR (1000-1)
#define MOTO_PWM_ARR (7500-1)
#define LED1_Pin GPIO_PIN_0
#define LED1_GPIO_Port GPIOA
#define LED2_Pin GPIO_PIN_1
#define LED2_GPIO_Port GPIOA
#define JY62_RXD_Pin GPIO_PIN_2
#define JY62_RXD_GPIO_Port GPIOA
#define JY62_TXD_Pin GPIO_PIN_3
#define JY62_TXD_GPIO_Port GPIOA
#define VL_SCL_Pin GPIO_PIN_4
#define VL_SCL_GPIO_Port GPIOA
#define VL_SDA_Pin GPIO_PIN_5
#define VL_SDA_GPIO_Port GPIOA
#define MOTO_L_PWMA_Pin GPIO_PIN_6
#define MOTO_L_PWMA_GPIO_Port GPIOA
#define MOTO_L_PWMB_Pin GPIO_PIN_7
#define MOTO_L_PWMB_GPIO_Port GPIOA
#define VL_SHUT_Pin GPIO_PIN_4
#define VL_SHUT_GPIO_Port GPIOC
#define MOTO_R_PWMA_Pin GPIO_PIN_0
#define MOTO_R_PWMA_GPIO_Port GPIOB
#define MOTO_R_PWMB_Pin GPIO_PIN_1
#define MOTO_R_PWMB_GPIO_Port GPIOB
#define VL_GPIO_Pin GPIO_PIN_2
#define VL_GPIO_GPIO_Port GPIOB
#define PS2_NSS_Pin GPIO_PIN_12
#define PS2_NSS_GPIO_Port GPIOB
#define PS2_CLK_Pin GPIO_PIN_13
#define PS2_CLK_GPIO_Port GPIOB
#define PS2_DAT_Pin GPIO_PIN_14
#define PS2_DAT_GPIO_Port GPIOB
#define PS2_CMD_Pin GPIO_PIN_15
#define PS2_CMD_GPIO_Port GPIOB
#define MOTO_L_ENCODER_A_Pin GPIO_PIN_6
#define MOTO_L_ENCODER_A_GPIO_Port GPIOC
#define MOTO_L_ENCODER_B_Pin GPIO_PIN_7
#define MOTO_L_ENCODER_B_GPIO_Port GPIOC
#define AT24C02_SCL_Pin GPIO_PIN_8
#define AT24C02_SCL_GPIO_Port GPIOC
#define AT24C02_SDA_Pin GPIO_PIN_9
#define AT24C02_SDA_GPIO_Port GPIOC
#define SERVO_L_Pin GPIO_PIN_8
#define SERVO_L_GPIO_Port GPIOA
#define SERVO_R_Pin GPIO_PIN_11
#define SERVO_R_GPIO_Port GPIOA
#define LED3_Pin GPIO_PIN_12
#define LED3_GPIO_Port GPIOA
#define LED4_Pin GPIO_PIN_12
#define LED4_GPIO_Port GPIOC
#define MOTO_R_ENCODER_A_Pin GPIO_PIN_6
#define MOTO_R_ENCODER_A_GPIO_Port GPIOB
#define MOTO_R_ENCODER_B_Pin GPIO_PIN_7
#define MOTO_R_ENCODER_B_GPIO_Port GPIOB
#define I2C3_SCL_Pin GPIO_PIN_8
#define I2C3_SCL_GPIO_Port GPIOB
#define I2C3_SDA_Pin GPIO_PIN_9
#define I2C3_SDA_GPIO_Port GPIOB

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
